
  /* 基础布局 - 三层结构划分 */
.page {
  width: 100%;
  height: 100vh;
  background-color: #f9f9f9;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* 基础阴影层 */
  box-shadow: inset 0 0 1px rgba(0, 0, 0, 0.05);
}

/* 顶部导航区（10%高度） */
.top-nav {
  height: 10vh;
  flex-shrink: 0;
  background-color: #f9f7f7;
  border-bottom: 1px solid rgba(0, 0, 0, 0.03); /* 底部分隔线增强层级 */
  padding: 0 15px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  position: relative;
  /* 顶部导航阴影层 */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.back-icon {
  width: 24px;
  height: 24px;
  z-index: 2; /* 交互元素层级提升 */
  transition: transform 0.2s;
}
.back-icon:active {
  transform: scale(0.9); /* 点击反馈 */
}

.title {
  font-size: 20px;
  font-weight: 600;
  color: #333; /* 深色增强标题层级 */
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  /* 文字阴影增强可读性 */
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

/* 聊天内容区（78%高度） */
.chat-container {
  flex: 1; /* 自动填充剩余空间*/
  padding: 15px;
  box-sizing: border-box;
  overflow-y: auto;
  position: relative;
  /* 内容区背景分层 */
  background-image:
          linear-gradient(rgba(249, 247, 247, 0.8), rgba(249, 247, 247, 0.8)),
          url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d1d1d1' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.message-list {
  width: 100%;
  max-width: 500px; /* 限制内容宽度，增强可读性 */
  margin: 0 auto; /* 居中内容 */
  padding-bottom: 20px;
}

/* 消息气泡样式 - 核心视觉层级 */
.message {
  display: flex;
  margin-bottom: 16px; /* 消息间距 */
  max-width: 100%;
  align-items: flex-start;
  animation: fadeIn 0.3s ease-out; /* 消息出现动画 */
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.user-message { justify-content: flex-end; }
.ai-message { justify-content: flex-start; }

.message-content {
  padding: 12px 18px;
  border-radius: 18px;
  max-width: 75%;
  word-wrap: break-word;
  line-height: 1.6;
  position: relative;
  /* 气泡阴影分层 */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: transform 0.2s;
}
.message-content:hover {
  transform: translateY(-1px); /* 悬浮反馈 */
}

.user-message .message-content {
  background-color: #E8F5E9;
  border-top-right-radius: 4px; /* 区分用户/AI气泡 */
  /* 用户气泡额外高光 */
  background-image: linear-gradient(to right, #E8F5E9, #f0faf1);
}

.ai-message .message-content {
  background-color: #ffffff;
  border: 1px solid #f0f0f0;
  border-top-left-radius: 4px;
  /* AI气泡轻微纹理 */
  background-image: linear-gradient(to right, #ffffff, #fafafa);
}

.question-content, .answer-content {
  font-size: 16px;
  color: #555;
  line-height: 1.7;
}

.image-placeholder {
  display: block;
  margin: 5px 0;
}

/* 头像样式 - 增强身份识别 */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
  font-size: 16px;
  font-weight: 500;
  /* 头像阴影 */
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  z-index: 1; /* 确保在气泡下方 */
}

.user-avatar {
  background-color: #FFC107;
  margin-left: 12px;
  /* 用户头像渐变 */
  background-image: linear-gradient(135deg, #FFC107, #ffd54f);
}

.ai-avatar {
  background-color: #00BCD4;
  margin-right: 12px;
  /* AI头像渐变 */
  background-image: linear-gradient(135deg, #00BCD4, #26c6da);
}

/* 输入区域（14%高度） */
.input-area {
  height: 14vh;
  flex-shrink: 0;
  background-color: white;
  border-top: 1px solid #eee;
  padding: 0 15px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 12px;
  /* 输入区顶部阴影 */
  box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.03);
  position: relative; /* 为预览图提供定位基准 */
}

/* 输入框样式 */
.input-field {
  flex: 1;
  min-height: 48px;
  max-height: 100px;
  overflow-y: auto;
  resize: none;
  padding: 12px 15px;
  border: 1px solid #eee;
  border-radius: 24px;
  box-sizing: border-box;
  font-size: 16px;
  color: #333;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: border-color 0.2s, box-shadow 0.2s;
  white-space: pre-line;
  word-break: break-all; /* 当单词过长时强制换行，避免溢出 */
}
.input-field:focus {
  outline: none;
  border-color: #d0e9f0;
  box-shadow: inset 0 1px 3px rgba(0, 188, 212, 0.1);
}

/* 媒体操作区（上传+麦克风） */
.media-actions {
  display: flex;
  flex-direction: column;
  gap: 10px; /* 垂直间距 */
  align-items: center; /* 居中对齐 */
  padding: 5px 0;
}

.upload-icon, .voice-input {
  width: 28px; /* 统一尺寸 */
  height: 28px;
  cursor: pointer;
  z-index: 2;
  transition: all 0.2s;
  opacity: 0.85;
}
.upload-icon:hover, .voice-input:hover {
  opacity: 1;
  transform: scale(1.05); /* 悬浮放大 */
}
.upload-icon:active, .voice-input:active {
  transform: scale(0.95); /* 点击缩小 */
}

/* 发送按钮 */
.send-icon {
  width: 28px;
  height: 28px;
  cursor: pointer;
  z-index: 2;
  transition: all 0.2s;
  opacity: 0.85;
}
.send-icon:not(.disabled):hover {
  opacity: 1;
  transform: scale(1.05);
}
.send-icon:not(.disabled):active {
  transform: scale(0.95);
}
.send-icon.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 加载指示器 */
.loading-indicator {
  display: flex;
  gap: 6px;
  padding: 10px 0 0 54px;
}
.loading-indicator .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #00BCD4;
  animation: bounce 1.4s infinite ease-in-out both;
}
.loading-indicator .dot:nth-child(1) { animation-delay: -0.32s; }
.loading-indicator .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* 图片样式 */
.plant-image, .user-image {
  width: 100%;
  margin-top: 10px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  transition: transform 0.3s;
}
.plant-image:hover, .user-image:hover {
  transform: scale(1.01);
}

/* 图片预览（底部16%-36%区域） */
.image-preview {
  position: absolute;
  left: 20px;
  bottom: calc(16vh + 10px); /* 从底部16%高度开始向上 */
  top: auto;
  width: 100px;
  height: 100px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #eee;
  z-index: 3; /* 最高层级 */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}
.image-preview:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

/* 图片删除按钮 */
.remove-image {
  position: absolute;
  top: -8px;
  right: -8px;
  background-color: #ff4d4f;
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(255, 77, 79, 0.3);
  transition: transform 0.2s;
}
.remove-image:active {
  transform: scale(0.8);
}

/* 响应式调整 */
@media (min-width: 375px) {
  .question-content, .answer-content { font-size: 17px; }
  .message-content { max-width: 78%; }
}

@media (min-width: 414px) {
  .question-content, .answer-content { font-size: 18px; }
  .message-content { max-width: 80%; }
  .top-nav, .input-area { padding: 0 20px; }
}

@media (min-width: 768px) {
  .message-list { max-width: 600px; }
  .avatar { width: 40px; height: 40px; }
  .message-content { padding: 14px 20px; }
}